<%@ page language="java" import="java.util.*"  import="com.gxuwz.medical.domain.person.*" import="com.gxuwz.medical.domain.pay.*" pageEncoding="utf-8" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="/medical/css/pintuer.css">
<link rel="stylesheet" href="/medical/css/admin.css">
<script src="/medical/js/jquery-1.4.4.min.js"></script>
<script src="/medical/js/pintuer.js"></script>
<script src="/medical/third/Lodop6/LodopFuncs.js"></script>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String familycode = request.getParameter("familycode");
List list = (List)request.getAttribute("noPayPerson");
Standard s = new Standard();
%>
<script>
var LODOP;
function preview(){
	createPage();
	LODOP.PREVIEW("_dialog",600,400);
}
function print_sure(){
	var ybcardnoarr =document.getElementsByName("ybcardno");
	for(var i=0;i<ybcardnoarr.length;i++){
		if(ybcardnoarr[i].checked==true){
			var name="";
			var cardno="";
			cardno=ybcardnoarr[i].value;
			name=ybcardnoarr[i].nextSibling.innerHTML;
			createPage(cardno,name);
			LODOP.PRINT();
			//LODOP.PREVIEW();
			}	
		}
	var form = document.getElementById("addform");
	form.submit();
}

function createPage(cardno,name){
		LODOP=getLodop();  
		LODOP.PRINT_INIT("参合缴费单");
		LODOP.SET_PRINT_PAGESIZE(1,1050,660,"");
		LODOP.SET_PRINT_STYLE("FontSize",18);
		LODOP.SET_PRINT_STYLE("Bold",1);
		LODOP.ADD_PRINT_RECT(10,10,380,230,0,1);
		LODOP.ADD_PRINT_TEXT(20,132,135,10,"参合缴费单");
		LODOP.SET_PRINT_STYLE("FontSize",12);
		LODOP.SET_PRINT_STYLE("Bold",0);
		LODOP.ADD_PRINT_TEXT(70,20,300,10,"家庭编号:"+document.getElementById("familycode").value);
		LODOP.ADD_PRINT_TEXT(100,20,300,10,"缴费成员医保卡号:"+cardno);
		LODOP.ADD_PRINT_TEXT(130,20,300,10,"缴费成员姓名:"+name);
		LODOP.ADD_PRINT_TEXT(160,20,300,10,"缴费金额(元):"+document.getElementById("money").value);
		LODOP.ADD_PRINT_TEXT(190,20,300,10,"缴费时间:"+new Date().getFullYear()+"年"+(new Date().getMonth()+1)+"月"+new Date().getDate()+"日"+new Date().getHours()+"时"+new Date().getMinutes()+"分"+new Date().getSeconds()+"秒");
}
function selectOnclick (){
	var ybcardnoarr =document.getElementsByName("ybcardno");
	var count = 0;
	for(var i=0;i<ybcardnoarr.length;i++){
		if(ybcardnoarr[i].checked==true){
			count++;
		}	
	}
	var pre = document.getElementById("money");
	var total = document.getElementById("total");
	total.value = pre.value*count;
	console.log(count);
}
function sure(){
	var total = document.getElementById("total");
	if(confirm("付款"+total.value+"?")){
		var form = document.getElementById("addform");
		form.submit();
	}
}

</script>
</head>
<body>

<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>参合缴费</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="<%=path %>/system/PayServlet?method=add" id="addform"> 
    
    	<div class="form-group">
        <div class="label">
          <label>家庭编号：</label>
        </div>
        <div class="field">
          <input  type="text" class="input w50" value="<%=familycode%>" id="familycode" name="familycode"  readonly="readonly"/>
	    </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>缴费成员：</label>
        </div>
        <div class="field">
          <%
      		int size = list.size();
      		for(int i=0;i<size;i++){
      		Person person = (Person)list.get(i);
      		%>
      		<input type="checkbox" name="ybcardno" value="<%=person.getYbcardno()%>" onclick="selectOnclick();" /><span><%=person.getFullname()%></span>
      		<br>
      		<%
      	}
       %>
	    </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>缴费单价：</label>
        </div>
        <div class="field">
          <input id="money" type="text" class="input w50" name="money" value="<%=s.getMoney() %>"  readonly="readonly"/>
	    </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>缴费总价：</label>
        </div>
        <div class="field">
          <input id="total" style="color:red" type="text" class="input w50" name="total" value="0.0"  readonly="readonly"/>
	    </div>
      </div>

    </form>
    <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
        <button class="button bg-main icon-check-square-o" type="button" onclick="print_sure();"> 打印，并提交</button>
        <button class="button bg-main icon-check-square-o" type="button" onclick="sure();"> 不打印,直接提交</button>
        </div>
      </div>
  </div>
</div>

</body></html>